<?php

function fnInsertFile($PaperId,$FileName,$FileBlob,$FileSize,$FileType) {
    $results = mysql_query("INSERT INTO `mst_file`(paper_id,upload_date,filename,fileblob,filesize,filetype)
                            VALUES ('$PaperId',curdate(),'$FileName','$FileBlob','$FileSize','$FileType') ");
    return $results;
}
    
function fnUpdateFile($FileName,$FileBlob,$FileSize,$FileType,$FileId) {
    $results = mysql_query("UPDATE `mst_file` SET 
                            paper_id='$PaperId'
                            upload_date=curdate(),
                            filename='$FileName',
                            fileblob='$FileBlob',
                            filesize='$FileSize',
                            filetype='$FileType'
                            WHERE `paper_id` = '$FileId'");
    return $results;
}
    
function fnDeleteFile($FileId) {
    $results = mysql_query("DELETE FROM `mst_file` 
                            WHERE `paper_id` = '$FileId'");
    return $results;
}

function fnSelectFile($FileId) {
    $results = mysql_query("SELECT filename,fileblob,filesize,filetype 
                            FROM `mst_file` 
                            WHERE `paper_id` = '$FileId'");
    return $results;
}

?>
